from Linklei import LinkList
from gongneng import *
if __name__ == '__main__':
    student_count = LinkList()
    jiemian()
    while True:
        mingling = input('请输入命令：').strip().upper()
        mllist = ['A', 'L', 'P', 'S','R']
        if student_count.is_empty():
            if mingling in mllist:
                print('成绩表为空！请先使用命令 T 录入学生成绩。')
                continue
            elif mingling=='H':
                Help()
            elif mingling == 'T':
                Type(student_count)
                print('成绩录入成功！')
                continue
            elif mingling == 'Q':
                break
            else:
                print('您输入的命令暂不支持！')
        else:
            if mingling == 'T':
                print('系统已录入成绩，无法执行该命令！')
            else:
                match mingling:
                    case 'A':
                        Average(student_count)
                    case 'L':
                        List(student_count)
                    case 'P':
                        Sort(student_count)
                    case 'S':
                        Search(student_count)
                    case 'H':
                        Help()
                    case 'Z':
                        Zchengji(student_count)
                    case 'R':
                        keshi(student_count)
                    case 'Q':
                        break
                    case _:
                        print('您输入的命令暂不支持！')